package com.untilov.gb.se.http.cookies;

import java.util.Vector;

import javax.net.ssl.HttpsURLConnection;

import com.untilov.gb.http.cookies.AbstractCookiesManager;
import com.untilov.gb.http.cookies.CookiesManagerIF;

public class CookiesManagerSEImpl extends AbstractCookiesManager implements
        CookiesManagerIF {

    public void processCookies(Object connection) throws Exception {
        HttpsURLConnection cConnection = (HttpsURLConnection) connection;
        setCookies(new Vector());
        int i = 1;
        String headerKey;
        while ((headerKey = cConnection.getHeaderFieldKey(i)) != null) {
            if (headerKey.equals("Set-Cookie")) {
                getCookies().add(cConnection.getHeaderField(i));
            }
            i++;
        }
    }
}
